import request from '@/utils/request.js'

//获取购物车列表
export const getCartList = () => request.get('/api/carts')

//添加购物车商品
export const addCart = (obj) => request.post('/api/carts', obj)

//删除购物车商品
export const delCartItem = (id) => request.delete(`/api/carts/${id}`)

//改变购物车选中
export const togChecked = (cart_ids) =>
  request.patch('/api/carts/checked', {
    cart_ids
  })

//改变购物车数量
export const togItemNum = (id, num) => request.put(`/api/carts/${id}`, { num })
